const canvasElement = document.createElement('canvas');

canvasElement.width = window.innerWidth;
canvasElement.height = window.innerHeight;
canvasElement.style.backgroundColor = '#000';
document.body.appendChild(canvasElement);

const ctx = canvasElement.getContext('2d'); //2d 上下文对象

const image = new Image();
image.src = 'https://picsum.photos/600';
image.onload = () =>{
  ctx.drawImage(image, 0, 0); // 绘制图片
}
